import Vue from 'vue'
import Vuex from 'vuex'
import createPersistedState from 'vuex-persistedstate'
import user from './modules/user'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {},
  getters: {
    token: state => {
      return state.user.token
    },
  },
  mutations: {},
  actions: {},
  modules: {
    user,
  },
  plugin: [
    createPersistedState({
      key: 'toutiao-pc-2.x-vuex',
      paths: ['user'],
    }),
  ],
})
